import Vue from 'vue'
import Router from 'vue-router'
import Login from "@/pages/Login"
import Main from "@/pages/Main"

Vue.use(Router)

//取消页面跳转冗余报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: [{
      path: '/',
      name: 'login',
      component: Login
    },
    {
      path: "/main",
      name: "main",
      component: Main,
      children: [{
          path: "/",
          name: "index",
          component: () => import("@/pages/Index.vue")
        },
        {
          path: "/doctor/list",
          name: "user-list",
          component: () => import("@/components/user/UserList.vue")
        },
        {
          path: "/purchase/list",
          name: "purchase-list",
          component: () => import("@/components/drug/DrugList.vue")
        },
        {
          path: "/department/list",
          name: "department-list",
          component: () => import("@/components/department/DepartmentList.vue")
        },
        {
          path: "/supplier/list",
          name: "supplier-list",
          component: () => import("@/components/supplier/SupplierList.vue")
        },
        {
          path: "/document/list",
          name: "document-list",
          component: () => import("@/components/personnel/PersonnelList.vue")
        },
        {
          path: "/seeADoctor/list",
          name: "seeADoctor-list",
          component: () => import("@/components/seeADoctor/SeeADoctorList.vue")
        }, {
          path: "/information/list",
          name: "information-list",
          component: () => import("@/components/appointment/InformationList.vue")
        },
        {
          path: "/record/list",
          name: "record/list",
          component: () => import("@/components/appointment/RecordList.vue")
        },
        {
          path: "/interactive/index",
          name: "interactive/index",
          component: () => import("@/components/appointment/ContentList.vue")
        },
        {
          path: "/drug/charge",
          name: "/drug/charge",
          component: () => import("@/components/accurately/DrugchargeList.vue")
        },
        {
          path: "/log/list",
          name: "log-list",
          component: () => import("@/components/log/Log.vue")
        },
        {
          path: "/spending/index",
          name: "spending-index",
          component: () => import("@/components/spending/index.vue")
        },
        {
          path: "/income/index",
          name: "income-index",
          component: () => import("@/components/income/index.vue")
        } ,{
        path: "/Outpatient/charge",
        name: "outpatient/charge",
        component: () => import("@/components/accurately/OutpatientCharge.vue")
      },
      {
        path: "/bodycheck/charge",
        name: "bodycheck/charge",
        component: () => import("@/components/accurately/BodyCharge.vue")
      },
      {
        path: "/Registration_fee/index",
        name: "Registration_fee/index",
        component: () => import("@/components/appointment/RegistrationfeeIndex.vue")
      },
      {
        path: "/seeADoctor/list",
        name: "seeADoctor-list",
        component: () => import("@/components/seeADoctor/SeeADoctorList.vue")
      },
      {
        path: "/jobs/list",
        name: "jobs-list",
        component: () => import("@/components/role/RoleList.vue")
      },
      {
        path: "/hospitalization/list",
        name: "hospitalization-list",
        component: () => import("@/components/hospitalized/HospitalizedList.vue")
      },
      {
        path: "/menu/list",
        name: "menu-list",
        component: () => import("@/components/menu/MenuList.vue")
      },
      {
        path: "/log/list",
        name: "log-list",
        component: () => import("@/components/log/Log.vue")
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
]
})
